using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "SOTATHE", Schema="dbo")]
	[Table(Name = "[dbo].[SOTATHE]")]
	public partial class SOTATHE : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _masotathe;

		private System.Guid? _magiaodan;

		private System.Int32? _ngay;

		private System.Int32? _thang;

		private System.Int32? _nam;

		private System.String _tai;

		private System.String _diadiemantang;

		private System.String _ghichu;

		private GIAODAN _prt_giaodan;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MASOTATHE", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MASOTATHE
		{
			get
			{
				return _masotathe;
			}
			set
			{
				OnChanged(this, "MASOTATHE");
				_masotathe = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAODAN", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAODAN
		{
			get
			{
				return _magiaodan;
			}
			set
			{
				OnChanged(this, "MAGIAODAN");
				_magiaodan = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NGAY", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NGAY
		{
			get
			{
				return _ngay;
			}
			set
			{
				OnChanged(this, "NGAY");
				_ngay = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "THANG", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? THANG
		{
			get
			{
				return _thang;
			}
			set
			{
				OnChanged(this, "THANG");
				_thang = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "NAM", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? NAM
		{
			get
			{
				return _nam;
			}
			set
			{
				OnChanged(this, "NAM");
				_nam = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TAI", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TAI
		{
			get
			{
				return _tai;
			}
			set
			{
				OnChanged(this, "TAI");
				_tai = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIADIEMANTANG", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIADIEMANTANG
		{
			get
			{
				return _diadiemantang;
			}
			set
			{
				OnChanged(this, "DIADIEMANTANG");
				_diadiemantang = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 2000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "GHICHU", DbType = "nvarchar(2000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String GHICHU
		{
			get
			{
				return _ghichu;
			}
			set
			{
				OnChanged(this, "GHICHU");
				_ghichu = value;
			}
		}

		public GIAODAN PRT_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaodan == default(GIAODAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN>.Select(this, "PRT_GIAODAN", new[] { new Vector<string, string>("MAGIAODAN", "MAGIAODAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaodan;
			}
			set
			{
				_prt_giaodan = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(SOTATHE);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
